我們正在更新 Data API,以符合 YouTube 計算 Shorts 觀看次數的方式。
瞭解詳情
PlaylistImages: insert
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將圖片加入播放清單。
這個方法支援上傳媒體。上傳的檔案必須符合下列限制:
- 檔案大小上限:2MB
- 接受的長寬比:1:1 (正方形)
- 接受的媒體 MIME 類型:
image/jpeg
、image/png
配額影響:呼叫這個方法時,配額費用為 50 個單位。
要求
HTTP 要求
POST https://www.googleapis.com/youtube/v3/playlistImages
授權
這項要求需要至少擁有下列其中一個範圍的授權 (進一步瞭解驗證和授權)。
範圍 |
https://www.googleapis.com/auth/youtubepartner |
https://www.googleapis.com/auth/youtube |
https://www.googleapis.com/auth/youtube.force-ssl |
參數
下表列出這個查詢支援的參數。這裡列出的所有參數都是查詢參數。
參數 |
必要參數 |
part |
string
part 參數會指定
包含一或多項 playlistImage 資源的清單 (以半形逗號分隔)
API 回應包含的屬性。
如果參數
會識別內含子屬性的屬性,也就是子屬性
。
|
選用參數 |
onBehalfOfContentOwner |
string
這個參數只能用於正確的授權請求。注意:這個參數僅適用於 YouTube 內容合作夥伴。
onBehalfOfContentOwner 參數代表要求的授權憑證可識別 YouTube CMS 使用者,這些使用者是代表參數值中指定的內容擁有者。這個參數適用於擁有並管理許多不同 YouTube 頻道的 YouTube 內容合作夥伴。內容擁有者只要進行驗證一次,就能存取所有的影片和頻道資料,不必分別提供各個頻道的驗證憑證。使用者驗證的 CMS 帳戶必須連結至指定的 YouTube 內容擁有者。 |
onBehalfOfContentOwnerChannel |
string
這個參數只能用於正確的授權請求。注意:這個參數僅適用於 YouTube 內容合作夥伴。
onBehalfOfContentOwnerChannel 參數
指明影片所屬頻道的 YouTube 頻道 ID
已新增。要求指定
onBehalfOfContentOwner 參數,且只能用於
傳送給該參數此外,請求
授權的內容管理系統 (CMS 帳戶) 已連結至
onBehalfOfContentOwner 參數會指定。最後,
onBehalfOfContentOwnerChannel 參數值的管道
指明必須連結至該內容擁有者的
onBehalfOfContentOwner 參數會指定。
這是
參數適用於擁有並管理的 YouTube 內容合作夥伴
不同的 YouTube 頻道內容擁有者可透過一次驗證
並代表參數中指定的管道
值,而無須為每個應用程式提供驗證憑證
。 |
要求主體
在要求主體中提供 playlistImages 資源。
針對該資源:
-
您必須指定這些屬性的值:
snippet.playlistId
snippet.type
-
您可以設定這些屬性的值:
snippet.width
snippet.height
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-16 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-08-16 (世界標準時間)。"],[[["This API method adds an image to a playlist, supporting media uploads with a maximum file size of 2MB and a 1:1 aspect ratio, and only accepts `image/jpeg` and `image/png` MIME types."],["Using this method requires authorization with scopes such as `https://www.googleapis.com/auth/youtubepartner`, `https://www.googleapis.com/auth/youtube`, or `https://www.googleapis.com/auth/youtube.force-ssl`."],["The `part` parameter is required to specify the `playlistImage` resource properties to be included in the API response."],["The `onBehalfOfContentOwner` and `onBehalfOfContentOwnerChannel` parameters are available for YouTube content partners managing multiple channels to authenticate once and access data across all channels."],["The request body requires a `playlistImages` resource with `snippet.playlistId` and `snippet.type`, and it can include optional `snippet.width` and `snippet.height` properties."]]],["To add an image to a playlist, send a POST request to `https://www.googleapis.com/youtube/v3/playlistImages`, ensuring authorization with appropriate scopes. Uploaded images must be square (1:1 aspect ratio), under 2MB, and be either JPEG or PNG. The request requires the `part` parameter, and the request body must include `snippet.playlistId` and `snippet.type`. Optional parameters include `onBehalfOfContentOwner` and `onBehalfOfContentOwnerChannel`. A successful call returns a `playlistImages` resource and has a quota cost of 50 units.\n"]]